package com.atguigu.lease.common.springmvc;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * 自定义异常，继承RuntimeException
 */

@Data
public class LeaseException extends RuntimeException{
    int code;

    public LeaseException(String message, int code) {
        //message在父类中
        super(message);
        this.code = code;
    }

    //定义接收枚举类的构造函数
    public LeaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
